package com.sh.redis.controller;

import java.util.Arrays;

public class RgbPixel {
    public static void main(String[] args) {
        int[] a = {3,8,7,1,4,5,2,3};
        quickSort(a,0,a.length-1);
        System.out.println(Arrays.toString(a));
    }

    private static void quickSort(int[] nums,int low,int high){
        if(low >= high){
            return ;
        }

        int i,j,k,temp;
        i = low;
        j = high;
        temp = nums[low];
        while(i < j){
            while(nums[j] >= temp && i<j){
                j--;
            }
            while(nums[i] <= temp && i<j){
                i++;
            }

            k = nums[j];
            nums[j] = nums[i];
            nums[i] = k;
        }

        nums[low] = nums[i];
        nums[i] = temp;
quickSort(nums, low, i-1);
quickSort(nums, i+1,high);


    }



}
